Skip to content

[18.0][FIX] web_company_color: integer division in image color extraction#3551

Open
fsmw wants to merge 1 commit into
OCA:18.0from
fsmw:18.0-fix-web-company-color-integer-division
Open

[18.0][FIX] web_company_color: integer division in image color extraction#3551
fsmw wants to merge 1 commit into
OCA:18.0from
fsmw:18.0-fix-web-company-color-integer-division

Conversation

@fsmw
Copy link
Copy Markdown

@fsmw fsmw commented May 16, 2026

Issue

Closes #3532

In image_to_rgb() pixel loop uses i / width returning float in Python 3, causing getpixel() to raise TypeError in Pillow >= 10.2.0 because coordinates must be integers. This completely blocks color extraction when a logo is set.

Steps to reproduce

  1. Install web_company_color on Odoo >= 18.0
  2. Set a company logo
  3. Click 'Compute Colors from Logo'
  4. Traceback: TypeError - 'float' object cannot be interpreted as an integer

Fix

Replace i / width with i // width so getpixel() receives integer coordinates.

Backward Compatibility

Fully backward compatible; the behavior is identical for valid integer widths and fixes the crash with newer Pillow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:web_company_color Module web_company_color series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web_company_color: Error when computing colors when using webp image as logo

2 participants